﻿using EmoneyWeiXinCommon;
using EmoneyWeiXinDAL;
using EmoneyWeiXinEntity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EmoneyWeiXinBLL
{
    public class KeyWordBLL
    {
        private static string key = CacheManager.GetCachedKey("key_word");

        public static IList<KeyWordModel> getKeyWordForMatch()
        {
            List<KeyWordModel> list = CacheManager.DefaultCache.Get<List<KeyWordModel>>(key);
            if (list == null)
            {
                list = KeyWordBLL.getKeyWord().Where(x => x.isActive == true).ToList();
                CacheManager.DefaultCache.Set<List<KeyWordModel>>(key, list, 5);
            }
            return list;
        }

        /// <summary>
        /// 查询关键字
        /// </summary>
        /// <returns></returns>
        public static IList<KeyWordModel> getKeyWord()
        {
            return KeyWordDal.getKeyWord();
        }
    }
}
